package ma.ensao.egicom.bank.services.dao.imlementations;

import java.util.List;
import java.util.Map;

import ma.ensao.egicom.bank.services.dao.interfaces.HibernateDaoBaseImplementationPatch;
import ma.ensao.egicom.bank.services.dao.interfaces.OperationDao;
import ma.ensao.egicom.bank.services.model.Operation;

/**
 * Impl&eacute;mentation de l'interface <code>OperationDao</code>.
 * @author MILHI Yassine (milhi.yassinee@gmail.com)
 */
public class OperationDaoImpl extends HibernateDaoBaseImplementationPatch implements OperationDao {

    /**
     * {@inheritDoc}
     */
    @Override
    public void createOperation(Operation operation) {
        save(operation);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void deleteOperation(Operation operation) {
        delete(operation);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Operation getOperationById(Long idOperation) {
        return load(idOperation, Operation.class);

    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void updateOperation(Operation operation) {
        update(operation);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    @SuppressWarnings("unchecked")
    public List<Operation> getOperationByProperty(String propertyName, Object value) {
        return (List<Operation>) getOperationByProperty(propertyName, value, Operation.class, "operation");

    }

    /**
     * {@inheritDoc}
     */
    @Override
    @SuppressWarnings("unchecked")
    public List<Operation> getOperationByProperties(Map<String, Object> properties) {
        return (List<Operation>) getOperationByProperties(properties, Operation.class, "operation");

    }

}
